from com.cjc.main_spider import main_spider
from com.cjc import conn_mysql
import threading
import time
# ——————————————程序入口——————————————————
# 开启四个线程


start_time=time.clock()
list=conn_mysql.find_dict_item2_code()

# main_spider(40,44)

# 设置每个线程的范围
t1 = threading.Thread(target=main_spider, args=(0,6,"thread_1："))
t2 = threading.Thread(target=main_spider, args=(6,12,"thread_2："))
t3 = threading.Thread(target=main_spider, args=(12,18,"thread_3："))
t4 = threading.Thread(target=main_spider, args=(18,24,"thread_4："))

t5 = threading.Thread(target=main_spider, args=(24,30,"thread_5："))
t6 = threading.Thread(target=main_spider, args=(30,36,"thread_6："))
t7 = threading.Thread(target=main_spider, args=(36,42,"thread_7："))
t8 = threading.Thread(target=main_spider, args=(42,48,"thread_8："))
t9 = threading.Thread(target=main_spider, args=(48,54,"thread_9："))
t10 = threading.Thread(target=main_spider, args=(54,60,"thread_10："))

t1.start()
t2.start()
t3.start()
t4.start()
t5.start()
t6.start()
t7.start()
t8.start()
t9.start()
t10.start()

t1.join()
t2.join()
t3.join()
t4.join()
t5.join()
t6.join()
t7.join()
t8.join()
t9.join()
t10.join()


end_time =time.clock()
print("程序运行："+str(end_time-start_time)+"秒")
# 程序运行：1379.6267946秒  22min
